package com.sun.eureka.controller;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.sun.eureka.entry.Customer;
import com.sun.eureka.remoter.Order;
import com.sun.eureka.service.ICustomerService;

@RestController
public class CustomerController {
	
	@Autowired
	private ICustomerService customerService;
	
	@RequestMapping("/customer/orders/{id}")
	public Order getOrderByCustomerId(@PathVariable("id") Long id) {
		return customerService.getOrderByCustomerId(id);
	}
	
	@RequestMapping("/customer/{id}")
	public Customer getCustomerId(@PathVariable("id") Long id) {
		//TimeUnit.MINUTES.sleep(1);
		return customerService.get(id);
	}
}
